package com.ggh.jinjilive.views;

import android.content.Context;

import com.ggh.jinjilive.views.divideritemdecoration.Y_Divider;
import com.ggh.jinjilive.views.divideritemdecoration.Y_DividerBuilder;
import com.ggh.jinjilive.views.divideritemdecoration.Y_DividerItemDecoration;

public class DividerItemDecoration extends Y_DividerItemDecoration {

    public DividerItemDecoration(Context context) {
        super(context);
    }

    @Override
    public Y_Divider getDivider(int itemPosition) {
        Y_Divider divider = null;
        if(itemPosition > 0){
            switch (itemPosition % 2) {
                case 0:
                    //每一行第一个显示rignt和bottom
                    divider = new Y_DividerBuilder()
                            .setRightSideLine(true, 0, 10, 0, 0)
                            .setTopSideLine(true,  0, 10, 0, 0)
                            .setLeftSideLine(true,  0, 5, 0, 0)
                            .create();
                    break;
                case 1:
                    //第二个显示Left和bottom
                    divider = new Y_DividerBuilder()
                            .setLeftSideLine(true,  0, 10, 0, 0)
                            .setTopSideLine(true,  0, 10, 0, 0)
                            .setRightSideLine(true,  0, 5, 0, 0)
                            .create();
                    break;

            }
        }else {
            divider = new Y_DividerBuilder()
                    .setBottomSideLine(true, 0, 0, 0, 0)
                    .create();
        }
        return divider;
    }
}
